package ${package.Controller};


import org.springframework.web.bind.annotation.RequestMapping;
<#if swagger2>
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
</#if>
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Set;
<#if entityLombokModel>
import lombok.extern.slf4j.Slf4j;
</#if>
import ${package.Service}.${table.serviceName};

<#if restControllerStyle>
import org.springframework.web.bind.annotation.RestController;
<#else>
import org.springframework.stereotype.Controller;
</#if>
<#if superControllerClassPackage??>
import ${superControllerClassPackage};
</#if>

/**
 * <p>
 * (${table.name})${table.comment!} 前端控制器
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
<#if swagger2>
<#if table.comment??>
@Api(description = "${table.comment}")
<#else>
@Api(description = "${table.entityName}接口")
</#if>
</#if>
<#if entityLombokModel>
@Slf4j
</#if>
<#if restControllerStyle>
@RestController
<#else>
@Controller
</#if>
@RequestMapping("<#if package.ModuleName??>${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
<#if kotlin>
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>
<#if superControllerClass??>
public class ${table.controllerName} extends ${superControllerClass} {
<#else>
public class ${table.controllerName} {
</#if>

    @Autowired
    private ${table.serviceName} ${table.serviceName?uncap_first};

    @GetMapping
    <#if swagger2>
    @ApiOperation("${table.entityName}列表")
    </#if>
    public void list${table.entityName}s() {

    }

    @PostMapping
    <#if swagger2>
    @ApiOperation("保存${table.entityName}")
    </#if>
    public void insert${table.entityName}() {

    }

    @PutMapping
    <#if swagger2>
    @ApiOperation("更新${table.entityName}")
    </#if>
    public void update${table.entityName}() {

    }

    <#list table.fields as field>
        <#if field.keyFlag>
            <#assign keyPropertyName="${field.propertyName}"/>
            <#assign keyPropertyType="${field.propertyType}"/>
        </#if>
    </#list>

    @DeleteMapping("{id}")
    <#if swagger2>
    @ApiOperation("删除${table.entityName}")
    </#if>
    public void delete${table.entityName}(@PathVariable("id") ${keyPropertyType} ${keyPropertyName}) {

    }

    @PostMapping("batch")
    <#if swagger2>
    @ApiOperation("批量删除${table.entityName}")
    </#if>
    public void delete${table.entityName}Batch(@RequestBody Set<${keyPropertyType}> ${keyPropertyName}s) {

    }

    @GetMapping("{id}")
    <#if swagger2>
    @ApiOperation("查询${table.entityName}")
    </#if>
    public void query${table.entityName}(@PathVariable("id") ${keyPropertyType} ${keyPropertyName}) {

    }

}
</#if>
